package com.thread.count;

import java.util.Date;

public class MultithreadProcessingCount {

/*	public static void main(String[] args) {
		MultithreadProcessingCount multithreadProcessing = new MultithreadProcessingCount();
		extendsThread thread = new extendsThread();
		for (int j = 0; j < 5; j++) {
			new Thread(thread).start();
		}

	}*/

	int i = 10000000;

	class ThreadRunnable implements Runnable {

		private Thread tt;
		private String threadName;

		public ThreadRunnable() {

		}

		public void run() {

			// for (; i > 0; i--) {
			// System.out.println(i + "---" + Thread.currentThread().getName());
			// Thread.yield();
			// }
			long start = new Date().getTime();
			while (true) {
				synchronized (ThreadRunnable.class) {

					i--;
					if (i < 0) {
						break;
					}
					System.out.println(i + "---" + Thread.currentThread().getName());
				}
			}
			long end = new Date().getTime();
			System.out.println("��ʱ---" + (end - start));
		}

		public void counter() {

		}

		public void start() {
			System.out.println("threadName--" + threadName);
			if (tt == null) {
				tt = new Thread(this, threadName);
				tt.start();

			}
		}
	}
}
